# Maintainer: Laurent Carlier <lordheavym@gmail.com>

pkgname=vulkan-tools
pkgver=1.2.190
pkgrel=1
arch=(x86_64)
url="https://www.khronos.org/vulkan/"
pkgdesc="Vulkan Utilities and Tools"
license=('custom')
depends=('libx11' 'wayland' 'libvulkan.so')
makedepends=('git' 'cmake' 'python' 'vulkan-headers' 'vulkan-icd-loader' 'glslang' 'spirv-tools')
groups=('vulkan-devel')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/KhronosGroup/Vulkan-Tools/archive/v${pkgver}.tar.gz")
sha256sums=('0838197efda0f023519cd8d010b61a2c8898f786996f27644ae431b45b094fbf')

prepare() {
  cd "${srcdir}"/Vulkan-Tools*

  rm -rf build && mkdir build
}

build() {
  cd "${srcdir}"/Vulkan-Tools*/build

  cmake \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_SYSCONFDIR=/etc \
    -DCMAKE_INSTALL_DATADIR=/usr/share \
    -DCMAKE_SKIP_RPATH=True \
    -DBUILD_WSI_XCB_SUPPORT=On \
    -DBUILD_WSI_XLIB_SUPPORT=On \
    -DBUILD_WSI_WAYLAND_SUPPORT=On \
    -DBUILD_CUBE=ON \
    -DBUILD_VULKANINFO=ON \
    -DBUILD_ICD=OFF \
    -DGLSLANG_INSTALL_DIR=/usr \
    -DCMAKE_BUILD_TYPE=Release \
    ..
  make
}

package() {
  cd "${srcdir}"/Vulkan-Tools*/build
  
  make DESTDIR="${pkgdir}" install

  install -dm755 "${pkgdir}"/usr/share/licenses/${pkgname}
  install -m644 ../LICENSE.txt "${pkgdir}"/usr/share/licenses/${pkgname}/
}
